





% 
%   
% 
% 
%   
%   
% <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
% <html lang="en">
%   <head>
%       <meta http-equiv="X-UA-Compatible" content="IE=8"/>
%       	<script type="text/javascript" src="/includes_content/nextgen/scripts/jquery/jquery-latest.js"></script>
%       <!-- START OF GLOBAL NAV -->
%   <link rel="stylesheet" href="/matlabcentral/css/sitewide.css" type="text/css">
%   <link rel="stylesheet" href="/matlabcentral/css/mlc.css" type="text/css">
%   <!--[if lt IE 7]>
%   <link href="/matlabcentral/css/ie6down.css" type="text/css" rel="stylesheet">
%   <![endif]-->
% 
%       
%       <meta http-equiv="content-type" content="text/html; charset=UTF-8">
% <meta name="keywords" content="file exchange, matlab answers, newsgroup access, link exchange, matlab blog, matlab central, simulink blog, matlab community, matlab and simulink community">
% <meta name="description" content="File exchange, MATLAB Answers, newsgroup access, Links, and Blogs for the MATLAB &amp; Simulink user community">
% <link rel="stylesheet" href="/matlabcentral/css/fileexchange.css" type="text/css">
% <link rel="stylesheet" type="text/css" media="print" href="/matlabcentral/css/print.css" />
% <title>CATSTRUCT: catstruct(varargin)
%  -  File Exchange - MATLAB Central</title>
% <script src="/matlabcentral/fileexchange/javascripts/jquery_ujs.js?1351865445" type="text/javascript"></script>
% <script src="/matlabcentral/fileexchange/javascripts/application.js?1351865445" type="text/javascript"></script>
% <script src="/matlabcentral/fileexchange/javascripts/searchfield.js?1351865445" type="text/javascript"></script>
% <link href="/matlabcentral/fileexchange/stylesheets/application.css?1351865445" media="screen" rel="stylesheet" type="text/css" />
% <link rel="search" type="application/opensearchdescription+xml" title="Search File Exchange" href="/matlabcentral/fileexchange/search.xml" />
% 
% 
%   </head>
%     <body>
%       <div id="header">
%   <div class="wrapper">
%   <!--put nothing in left div - only 11px wide shadow --> 
%     <div class="main">
%         	<div id="logo"><a href="/matlabcentral/" title="MATLAB Central Home"><img src="/matlabcentral/images/mlclogo-whitebgd.gif" alt="MATLAB Central" /></a></div>
%       
%         <div id="headertools">
%         
% 
% <script language="JavaScript1.3" type="text/javascript">
% 
% function submitForm(query){
% 
% 	choice = document.forms['searchForm'].elements['search_submit'].value;
% 	
% 	if (choice == "entire1" || choice == "contest" || choice == "matlabcentral" || choice == "blogs"){
% 	
% 	   var newElem = document.createElement("input");
% 	   newElem.type = "hidden";
% 	   newElem.name = "q";
% 	   newElem.value = query.value;
% 	   document.forms['searchForm'].appendChild(newElem);
% 	      
% 	   submit_action = '/searchresults/';
% 	}
% 	
% 	switch(choice){
% 	   case "matlabcentral":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "c[]";
% 	      newElem.value = "matlabcentral";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      selected_index = 0;
% 	      break
% 	   case "fileexchange":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "term";
% 	      newElem.value = query.value;
% 	      newElem.classname = "formelem";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      submit_action = "/matlabcentral/fileexchange/";
% 	      selected_index = 1;
% 	      break
% 	   case "answers":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "term";
% 	      newElem.value = query.value;
% 	      newElem.classname = "formelem";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      submit_action = "/matlabcentral/answers/";
% 	      selected_index = 2;
% 	      break
% 	   case "cssm":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "search_string";
% 	      newElem.value = query.value;
% 	      newElem.classname = "formelem";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 		  submit_action = "/matlabcentral/newsreader/search_results";
% 	      selected_index = 3;
% 	      break
% 	   case "linkexchange":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "term";
% 	      newElem.value = query.value;
% 	      newElem.classname = "formelem";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      submit_action = "/matlabcentral/linkexchange/";
% 	      selected_index = 4;
% 	      break
% 	   case "blogs":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "c[]";
% 	      newElem.value = "blogs";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      selected_index = 5;
% 	      break
% 	   case "trendy":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "search";
% 	      newElem.value = query.value;
% 	      newElem.classname = "formelem";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      submit_action = "/matlabcentral/trendy";
% 	      selected_index = 6;
% 	      break
% 	   case "cody":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "term";
% 	      newElem.value = query.value;
% 	      newElem.classname = "formelem";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      submit_action = "/matlabcentral/cody/";
% 	      selected_index = 7;
% 	      break
% 	   case "contest":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "c[]";
% 	      newElem.value = "contest";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	
% 	      selected_index = 8;
% 	      break
% 	   case "entire1":
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "c[]";
% 	      newElem.value = "entiresite";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	      
% 	      selected_index = 9;
% 	      break
% 	   default:
% 	      var newElem = document.createElement("input");
% 	      newElem.type = "hidden";
% 	      newElem.name = "c[]";
% 	      newElem.value = "entiresite";
% 	      document.forms['searchForm'].appendChild(newElem);
% 	   
% 	      selected_index = 9;
% 	      break
% 	}
% 
% 	document.forms['searchForm'].elements['search_submit'].selectedIndex = selected_index;
% 	document.forms['searchForm'].elements['query'].value = query.value;
% 	document.forms['searchForm'].action = submit_action;
% }
% 
% </SCRIPT>
% 
% 
%   <form name="searchForm" method="GET" action="" style="margin:0px; margin-top:5px; font-size:90%" onSubmit="submitForm(query)">
%           <label for="search">Search: </label>
%         <select name="search_submit" style="font-size:9px ">
%          	 <option value = "matlabcentral">MATLAB Central</option>
%           	<option value = "fileexchange" selected>&nbsp;&nbsp;&nbsp;File Exchange</option>
%           	<option value = "answers">&nbsp;&nbsp;&nbsp;Answers</option>
%             <option value = "cssm">&nbsp;&nbsp;&nbsp;Newsgroup</option>
%           	<option value = "linkexchange">&nbsp;&nbsp;&nbsp;Link Exchange</option>
%           	<option value = "blogs">&nbsp;&nbsp;&nbsp;Blogs</option>
%           	<option value = "trendy">&nbsp;&nbsp;&nbsp;Trendy</option>
%           	<option value = "cody">&nbsp;&nbsp;&nbsp;Cody</option>
%           	<option value = "contest">&nbsp;&nbsp;&nbsp;Contest</option>
%           <option value = "entire1">MathWorks.com</option>
%         </select>
% <input type="text" name="query" size="10" class="formelem" value="">
% <input type="submit" value="Go" class="formelem gobutton" >
% </form>
% 
% 		  <ol id="access2">
%   <li class="first">
%     <a href="http://www.mathworks.com/accesslogin/createProfile.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Ffileexchange%2F7842-catstruct%2Fcontent%2Fcatstruct" id="create_account_link" rel="nofollow">Create Account</a>
%   </li>
%   <li>
%     <a href="https://www.mathworks.com/accesslogin/index_fe.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Ffileexchange%2F7842-catstruct%2Fcontent%2Fcatstruct" id="login_link" rel="nofollow">Log In</a>
%   </li>
% </ol>
% 
% 
%       </div>
% 	  
%         <div id="globalnav">
%         <!-- from includes/global_nav.html -->
%         <ol>
%                 <li class=";" >
%                         <a href="/matlabcentral/fileexchange/">File Exchange</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="/matlabcentral/answers/">Answers</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="/matlabcentral/newsreader/">Newsgroup</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="/matlabcentral/linkexchange/">Link Exchange</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="http://blogs.mathworks.com/">Blogs</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="/matlabcentral/trendy">Trendy</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="/matlabcentral/cody">Cody</a> 
%                 </li>
%                 <li class=";" >
%                         <a href="/matlabcentral/contest/">Contest</a> 
%                 </li>
%                 <li class="icon mathworks" >
%                         <a href="/">MathWorks.com</a> 
%                 </li>
%         </ol>
%       </div>
%     </div>
%   </div>
% </div>
% 
%       <div id="middle">
%   <div class="wrapper">
% 
%     <div id="mainbody" class="columns2">
% 
%   <div class="manifest">
%     <div class="ctaBtn ctaBlueBtn btnSmall">
%       <div class="btnCont">
%         <div class="btn download">
%           <a href="http://www.mathworks.com/matlabcentral/fileexchange/7842-catstruct?download=true" title="Download Now">Download Submission</a>
%         </div>  
%       </div>
%     </div>
% 
% 
%   <p class="license">   
%       Code covered by the <a href="/matlabcentral/fileexchange/view_license?file_info_id=7842" popup="new_window height=500,width=640,scrollbars=yes">BSD License</a>
%       <a href="/matlabcentral/fileexchange/help_license#bsd" class="info notext" onclick="window.open(this.href,'small','toolbar=no,resizable=yes,status=yes,menu=no,scrollbars=yes,width=600,height=550');return false;">&nbsp;</a>
%   </p>
% 
% 
%     <h3 class="highlights_title">
%       Highlights from<br/>
%       <a href="http://www.mathworks.com/matlabcentral/fileexchange/7842-catstruct" class="manifest_title">CATSTRUCT</a>
%     </h3>
% 
% 
%     <ul class="manifest">
%           <li class="manifest">
%               <a href="http://www.mathworks.com/matlabcentral/fileexchange/7842-catstruct/content/catstruct.m" class="function" title="Function">catstruct(varargin)
% </a>
%             <span class="description">CATSTRUCT - concatenate structures
% </span>
%           </li>
%       <li class="manifest_allfiles">
%         <a href="http://www.mathworks.com/matlabcentral/fileexchange/7842-catstruct/all_files">View all files</a></li>
%     </ul>
% </div>
% 
% 
%   <table cellpadding="0" cellspacing="0" class="details file">
%     <tr>
%       <th class="maininfo"> 
% 
%         <div id="details" class="content_type_details">
%           from 
%           <a href="/matlabcentral/fileexchange/file_infos/7842-catstruct" class="content_type_author">CATSTRUCT</a></h2>
%           by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/10584">Jos (10584)</a>
%           <br/>Concatenate structures (v2.2, oct 2008).
%           </p>
%         </div>
%       </th>
%     </tr>
%     <tr>
%       <td class="file">
%         <table cellpadding="0" cellspacing="0" border="0" class="fileview section">
%           <tr class="title">
%             <th><span class="heading">catstruct(varargin)
% </span></th>
%           </tr>
%           <tr>
%             <td>
%                 <div class="codecontainer"><pre class="matlab-code">function A = catstruct(varargin)
% CATSTRUCT - concatenate structures
%
%   X = CATSTRUCT(S1,S2,S3,...) concates the structures S1, S2, ... into one
%   structure X. 
%
%   Example:
%     A.name = 'Me' ; 
%     B.income = 99999 ; 
%     X = catstruct(A,B) 
%     % -&gt; X.name = 'Me' ;
%     %    X.income = 99999 ;
%
%   CATSTRUCT(S1,S2,'sorted') will sort the fieldnames alphabetically.
%
%   If a fieldname occurs more than once in the argument list, only the last
%   occurence is used, and the fields are alphabetically sorted.
%
%   To sort the fieldnames of a structure A use:
%     A = CATSTRUCT(A,'sorted') ;
%
%   To concatenate two similar array of structs use simple concatenation:
%     A = dir('*.mat') ; B = dir('*.m') ; C = [A ; B] ;
%
%   When there is nothing to concatenate, the result will be an empty
%   struct (0x0 struct array with no fields). 
%
%   See also CAT, STRUCT, FIELDNAMES, STRUCT2CELL

% for Matlab R13 and up
% version 2.2 (oct 2008)
% (c) Jos van der Geest
% email: jos@jasen.nl

% History
% Created:  2005
% Revisions
%   2.0 (sep 2007) removed bug when dealing with fields containing cell
%                  arrays (Thanks to Rene Willemink) 
%   2.1 (sep 2008) added warning and error identifiers
%   2.2 (oct 2008) fixed error when dealing with empty structs (Thanks to
%                  Lars Barring)
function A = catstruct(varargin)

N = nargin ;

error(nargchk(1,Inf,N)) ;

if ~isstruct(varargin{end}),
    if isequal(varargin{end},'sorted'),
        sorted = 1 ;
        N = N-1 ;
        if N &lt; 1,
            A = struct([]) ;
            return
        end
    else
        error('catstruct:InvalidArgument','Last argument should be a structure, or the string &quot;sorted&quot;.') ;
    end
else
    sorted = 0 ;
end

FN = cell(N,1) ;
VAL = cell(N,1) ;

for ii=1:N,
    X = varargin{ii} ;
    if ~isstruct(X),
        error('catstruct:InvalidArgument',['Argument #' num2str(ii) ' is not a structure.']) ;
    end
    if ~isempty(X),
        % empty structs are ignored
        FN{ii} = fieldnames(X) ;
        VAL{ii} = struct2cell(X) ; 
    end
end

FN = cat(1,FN{:}) ;
VAL = cat(1,VAL{:}) ;
[UFN,ind] = unique(FN) ;

if numel(UFN) ~= numel(FN),
    warning('catstruct:DuplicatesFound','Duplicate fieldnames found. Last value is used and fields are sorted') ;
    sorted = 1 ;
end

if sorted,
    VAL = VAL(ind) ;
    FN = FN(ind) ;
end

if ~isempty(FN),
    % This deals correctly with cell arrays
    A = cell2struct(VAL, FN);
else
    A = struct([]) ;
end


% 
% 
% </pre></div>
%             </td>
%           </tr>
%         </table>
%   
% 
% 
%       </td>
%     </tr>
%   
%   </table>
% 
% 
% <p id="contactus">Contact us at <a href="mailto:files@mathworks.com">files@mathworks.com</a></p>
% 
%       
% </div>
% <div class="clearboth">&nbsp;</div>
% </div>
% </div>
% <!-- footer.html -->
% <!-- START OF FOOTER -->
% 
% <div id="mlc-footer">
%   <script type="text/javascript">
% function clickDynamic(obj, target_url, tracking_code) {
% 	var pos=target_url.indexOf("?");
% 	if (pos<=0) { 
% 		var linkComponents = target_url + tracking_code;
% 		obj.href=linkComponents;
% 	} 
% }
% </script>
%   <div class="wrapper">
%     <div>
%       <ul id="matlabcentral">
%         <li class="copyright first">&copy; 1994-2012 The MathWorks, Inc.</li>
%         <li class="first"><a href="/help.html" title="Site Help">Site Help</a></li>
%         <li><a href="/company/aboutus/policies_statements/patents.html" title="patents" rel="nofollow">Patents</a></li>
%         <li><a href="/company/aboutus/policies_statements/trademarks.html" title="trademarks" rel="nofollow">Trademarks</a></li>
%         <li><a href="/company/aboutus/policies_statements/" title="privacy policy" rel="nofollow">Privacy Policy</a></li>
%         <li><a href="/company/aboutus/policies_statements/piracy.html" title="preventing piracy" rel="nofollow">Preventing Piracy</a></li>
%         <li class="last"><a href="/matlabcentral/termsofuse.html" title="Terms of Use" rel="nofollow">Terms of Use</a></li>
%         <li class="icon"><a href="/company/rss/" title="RSS" class="rssfeed" rel="nofollow"><span class="text">RSS</span></a></li>
%         <li class="icon"><a href="http://www-external-test.mathworks.com/programs/bounce_hub_generic.html?s_cid=mlc_fbk&url=https://plus.google.com/117177960465154322866?prsrc=3" title="Google+" class="google" rel="nofollow"><span class="text">Google+</span></a></li>
%         <li class="icon"><a href="http://www.mathworks.com/programs/bounce_hub_generic.html?s_cid=mlc_fbk&url=http://www.facebook.com/MATLAB" title="Facebook" class="facebook" rel="nofollow"><span class="text">Facebook</span></a></li>
%         <li class="last icon"><a href="http://www.mathworks.com/programs/bounce_hub_generic.html?s_cid=mlc_twt&url=http://www.twitter.com/MATLAB" title="Twitter" class="twitter" rel="nofollow"><span class="text">Twitter</span></a></li>
%       </ul>
%       <ul id="mathworks">
%         <li class="first sectionhead">Featured MathWorks.com Topics:</li>
%         <li class="first"><a href="/products/new_products/latest_features.html" onclick="clickDynamic(this, this.href, '?s_cid=MLC_new')">New Products</a></li>
%         <li><a href="/support/" title="support" onclick="clickDynamic(this, this.href, '?s_cid=MLC_support')">Support</a></li>
%         <li><a href="/help" title="documentation" onclick="clickDynamic(this, this.href, '?s_cid=MLC_doc')">Documentation</a></li>
%         <li><a href="/services/training/" title="training" onclick="clickDynamic(this, this.href, '?s_cid=MLC_training')">Training</a></li>
%         <li><a href="/company/events/webinars/" title="Webinars" onclick="clickDynamic(this, this.href, '?s_cid=MLC_webinars')">Webinars</a></li>
%         <li><a href="/company/newsletters/" title="newsletters" onclick="clickDynamic(this, this.href, '?s_cid=MLC_newsletters')">Newsletters</a></li>
%         <li><a href="/programs/trials/trial_request.html?prodcode=ML&s_cid=MLC_trials" title="MATLAB Trials">MATLAB Trials</a></li>
%         
%         		<li class="last"><a href="/company/jobs/opportunities/index_en_US.html" title="Careers" onclick="clickDynamic(this, this.href, '?s_cid=MLC_careers')">Careers</a></li>
%                  
%       </ul>
%     </div>
%   </div>
% </div>
% <!-- END OF FOOTER -->
% 
% 
%       
%       
% <!-- SiteCatalyst code version: H.24.4.
% Copyright 1996-2012 Adobe, Inc. All Rights Reserved
% More info available at http://www.omniture.com -->
% <script language="JavaScript" type="text/javascript" src="/scripts/omniture/s_code.js"></script>
% 
% 
% <script language="JavaScript" type="text/javascript">
% 
% 
% 
% <!--
% /************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
% var s_code=s.t();if(s_code)document.write(s_code)//--></script>
% <script language="JavaScript" type="text/javascript"><!--
% if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
% //--></script>
% <!--/DO NOT REMOVE/-->
% <!-- End SiteCatalyst code version: H.24.4. -->    </body>
% </html>
